.class public abstract Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;
.super Ljava/lang/Object;
.source "AbstractNetworkConfigurator.java"

# interfaces
.implements Lcom/burstly/lib/component/networkcomponent/INetworkConfigurator;


# annotations
.annotation system Ldalvik/annotation/Signature;
    value = {
        "<T:",
        "Ljava/lang/Object;",
        ">",
        "Ljava/lang/Object;",
        "Lcom/burstly/lib/component/networkcomponent/INetworkConfigurator",
        "<TT;>;"
    }
.end annotation


# static fields
.field private static final LOG:Lcom/burstly/lib/util/LoggerExt;


# direct methods
.method static constructor <clinit>()V
    .locals 1

    .prologue
    .line 39
    invoke-static {}, Lcom/burstly/lib/util/LoggerExt;->getInstance()Lcom/burstly/lib/util/LoggerExt;

    move-result-object v0

    sput-object v0, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    return-void
.end method

.method public constructor <init>()V
    .locals 0

    .prologue
    .line 34
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;,"Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator<TT;>;"
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method

.method protected static getAge(Ljava/util/Date;)Ljava/lang/Integer;
    .locals 9
    .parameter "dateOfBirth"

    .prologue
    const/4 v8, 0x5

    const/4 v7, 0x1

    const/4 v6, 0x2

    .line 108
    if-nez p0, :cond_0

    .line 109
    const/4 v5, 0x0

    .line 128
    :goto_0
    return-object v5

    .line 111
    :cond_0
    new-instance v4, Ljava/util/GregorianCalendar;

    invoke-direct {v4}, Ljava/util/GregorianCalendar;-><init>()V

    .line 112
    .local v4, cal:Ljava/util/GregorianCalendar;
    invoke-virtual {v4, p0}, Ljava/util/GregorianCalendar;->setTime(Ljava/util/Date;)V

    .line 115
    invoke-virtual {v4, v7}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v3

    .line 116
    .local v3, birthYear:I
    invoke-virtual {v4, v6}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v5

    add-int/lit8 v2, v5, 0x1

    .line 117
    .local v2, birthMonth:I
    invoke-virtual {v4, v8}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v1

    .line 118
    .local v1, birthDay:I
    new-instance v5, Ljava/util/Date;

    invoke-direct {v5}, Ljava/util/Date;-><init>()V

    invoke-virtual {v4, v5}, Ljava/util/GregorianCalendar;->setTime(Ljava/util/Date;)V

    .line 119
    invoke-virtual {v4, v7}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v5

    sub-int v0, v5, v3

    .line 120
    .local v0, ageInYears:I
    invoke-virtual {v4, v6}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v5

    if-gt v2, v5, :cond_1

    invoke-virtual {v4, v6}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v5

    if-ne v2, v5, :cond_2

    invoke-virtual {v4, v8}, Ljava/util/GregorianCalendar;->get(I)I

    move-result v5

    if-le v1, v5, :cond_2

    .line 123
    :cond_1
    add-int/lit8 v0, v0, -0x1

    .line 125
    :cond_2
    if-gez v0, :cond_3

    .line 126
    new-instance v5, Ljava/lang/IllegalArgumentException;

    const-string v6, "Age < 0"

    invoke-direct {v5, v6}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V

    throw v5

    .line 128
    :cond_3
    invoke-static {v0}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v5

    goto :goto_0
.end method

.method private logParameters()V
    .locals 13

    .prologue
    .line 60
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;,"Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator<TT;>;"
    :try_start_0
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/Class;->getDeclaredFields()[Ljava/lang/reflect/Field;

    move-result-object v1

    .line 61
    .local v1, declaredFields:[Ljava/lang/reflect/Field;
    invoke-virtual {p0}, Ljava/lang/Object;->getClass()Ljava/lang/Class;

    move-result-object v9

    invoke-virtual {v9}, Ljava/lang/Class;->getSimpleName()Ljava/lang/String;

    move-result-object v7

    .line 62
    .local v7, tag:Ljava/lang/String;
    sget-object v9, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v10, "Parsed parameters:"

    const/4 v11, 0x0

    new-array v11, v11, [Ljava/lang/Object;

    invoke-virtual {v9, v7, v10, v11}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    .line 63
    move-object v0, v1

    .local v0, arr$:[Ljava/lang/reflect/Field;
    array-length v5, v0

    .local v5, len$:I
    const/4 v4, 0x0

    .local v4, i$:I
    :goto_0
    if-ge v4, v5, :cond_1

    aget-object v3, v0, v4

    .line 64
    .local v3, field:Ljava/lang/reflect/Field;
    const/4 v9, 0x1

    invoke-virtual {v3, v9}, Ljava/lang/reflect/Field;->setAccessible(Z)V

    .line 65
    invoke-virtual {v3}, Ljava/lang/reflect/Field;->getName()Ljava/lang/String;

    move-result-object v6

    .line 66
    .local v6, name:Ljava/lang/String;
    invoke-virtual {v3, p0}, Ljava/lang/reflect/Field;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v8

    .line 67
    .local v8, value:Ljava/lang/Object;
    invoke-virtual {v3}, Ljava/lang/reflect/Field;->getModifiers()I

    move-result v9

    invoke-static {v9}, Ljava/lang/reflect/Modifier;->isStatic(I)Z

    move-result v9

    if-nez v9, :cond_0

    .line 68
    sget-object v9, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;->LOG:Lcom/burstly/lib/util/LoggerExt;

    const-string v10, "{0}={1}"

    const/4 v11, 0x2

    new-array v11, v11, [Ljava/lang/Object;

    const/4 v12, 0x0

    aput-object v6, v11, v12

    const/4 v12, 0x1

    aput-object v8, v11, v12

    invoke-virtual {v9, v7, v10, v11}, Lcom/burstly/lib/util/LoggerExt;->logDebug(Ljava/lang/String;Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    .line 63
    :cond_0
    add-int/lit8 v4, v4, 0x1

    goto :goto_0

    .line 72
    .end local v0           #arr$:[Ljava/lang/reflect/Field;
    .end local v1           #declaredFields:[Ljava/lang/reflect/Field;
    .end local v3           #field:Ljava/lang/reflect/Field;
    .end local v4           #i$:I
    .end local v5           #len$:I
    .end local v6           #name:Ljava/lang/String;
    .end local v7           #tag:Ljava/lang/String;
    .end local v8           #value:Ljava/lang/Object;
    :catch_0
    move-exception v2

    .line 73
    .local v2, exception:Ljava/lang/Exception;
    invoke-virtual {v2}, Ljava/lang/Exception;->printStackTrace()V

    .line 75
    .end local v2           #exception:Ljava/lang/Exception;
    :cond_1
    return-void
.end method


# virtual methods
.method protected applyClientTargetingIfAllowed(Ljava/util/Map;)V
    .locals 3
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .prologue
    .line 92
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;,"Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator<TT;>;"
    .local p1, paramsFromServer:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    const-string v2, "clientTargetingParams"

    invoke-interface {p1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Ljava/util/Map;

    .line 94
    .local v0, clientTargetingParams:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;Ljava/lang/String;>;"
    const-string v2, "rejectUserTargeting"

    invoke-interface {p1, v2}, Ljava/util/Map;->get(Ljava/lang/Object;)Ljava/lang/Object;

    move-result-object v1

    check-cast v1, Ljava/lang/String;

    .line 95
    .local v1, rejectUserTargeting:Ljava/lang/String;
    if-eqz v0, :cond_0

    invoke-interface {v0}, Ljava/util/Map;->size()I

    move-result v2

    if-lez v2, :cond_0

    const-string v2, "YES"

    invoke-virtual {v2, v1}, Ljava/lang/String;->equalsIgnoreCase(Ljava/lang/String;)Z

    move-result v2

    if-nez v2, :cond_0

    .line 97
    invoke-virtual {p0, v0}, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;->applyClientTargetingParamsToNetwork(Ljava/util/Map;)V

    .line 99
    :cond_0
    return-void
.end method

.method protected abstract applyClientTargetingParamsToNetwork(Ljava/util/Map;)V
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "Ljava/lang/String;",
            ">;)V"
        }
    .end annotation
.end method

.method public abstract configure(Ljava/lang/Object;)V
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(TT;)V"
        }
    .end annotation
.end method

.method public final initConfigurator(Ljava/util/Map;)V
    .locals 0
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/IllegalArgumentException;
        }
    .end annotation

    .prologue
    .line 43
    .local p0, this:Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;,"Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator<TT;>;"
    .local p1, paramsFromServer:Ljava/util/Map;,"Ljava/util/Map<Ljava/lang/String;*>;"
    invoke-virtual {p0, p1}, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;->readParameters(Ljava/util/Map;)V

    .line 44
    invoke-direct {p0}, Lcom/burstly/lib/component/networkcomponent/AbstractNetworkConfigurator;->logParameters()V

    .line 45
    return-void
.end method

.method protected abstract readParameters(Ljava/util/Map;)V
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/Map",
            "<",
            "Ljava/lang/String;",
            "*>;)V"
        }
    .end annotation

    .annotation system Ldalvik/annotation/Throws;
        value = {
            Ljava/lang/IllegalArgumentException;
        }
    .end annotation
.end method
